// 顶部的切换功能

// 查询所有动态的按钮以及他的容器
let queryDyAllBtn = document.getElementsByClassName("queryAllDy")[0];
let AllDyWapper = document.querySelector(".dynamic-BigBox");


// 获得顶部个人空间按钮以及容器以及容器
let queryPersonDyBtn = document.getElementsByClassName("queryPersonDy")[0];
let personDyWrapper = document.querySelector(".personDy-wrapper");


// 搜索按键以及容器
let searchDyBtn = document.querySelector(".searchDy");
let searchDyWrapper = document.querySelector(".search-BigBox");

let queryPersonABBtn = document.querySelector(".queryPersonAB");
let personABwrapper = document.querySelector(".personAB-wrapper");


// 查看所有动态并发送AJAX请求
queryDyAllBtn.addEventListener("click",function(){
  searchDyWrapper.style.display = "none";
  AllDyWapper.style.display = "flex";
  personDyWrapper.style.display = "none";
  personABwrapper.style.display = "none";

});

// 进入个人空间并发送AJAX请求
queryPersonDyBtn.onclick = function () {
    // 检测是否已登录
    if (window.userInfoG) {
        searchDyWrapper.style.display = "none";
        personDyWrapper.style.display = "block";
        AllDyWapper.style.display = "none";
        personABwrapper.style.display = "none";
        lookPersonDyBtn.click();
    }
    else {
        alert("请先登陆再进入个人空间");
    }
}

// 搜索动态界面
searchDyBtn.addEventListener("click",function(){
    AllDyWapper.style.display = "none";
    personDyWrapper.style.display = "none";
    personABwrapper.style.display = "none";
    searchDyWrapper.style.display = "block";
 
    
});

queryPersonABBtn.onclick = function(){
    if (window.userInfoG) {
        searchDyWrapper.style.display = "none";
        personDyWrapper.style.display = "none";
        AllDyWapper.style.display = "none";
        personABwrapper.style.display = "block";
        lookABbtn.click();
    }
    else {
        alert("请先登陆再进入个人相册");
    }
}